﻿@model IEnumerable<Product>
@{
    ViewBag.Title = "产品列表";
}

<style>
    body {
        font-family: Arial, sans-serif;
        background-color: #f9f9f9;
        margin: 0;
        padding: 20px;
    }

    h1 {
        text-align: center;
        color: #333;
        margin-bottom: 20px;
    }

    form {
        text-align: center;
        margin-bottom: 20px;
    }

    input[type="text"] {
        padding: 8px;
        width: 300px;
        border: 1px solid #ccc;
        border-radius: 4px;
        margin-right: 10px;
    }

    input[type="submit"] {
        padding: 8px 16px;
        background-color: #007BFF;
        color: white;
        border: none;
        border-radius: 4px;
        cursor: pointer;
    }

        input[type="submit"]:hover {
            background-color: #0056b3;
        }

    p {
        text-align: center;
        margin: 0;
    }

    a {
        margin: 0 10px;
        text-decoration: none;
        color: #007BFF;
    }

        a:hover {
            text-decoration: underline;
        }
</style>

<h1>@ViewBag.Title</h1>

<form method="get" asp-controller="Product" asp-action="Index">
    <p>
        产品名称: <input type="text" name="productName" value="@ViewData["CurrentFilter"]" />
        <input type="submit" value="搜索" />
    </p>
    <p>
        <a asp-action="Index" asp-route-sortOrder="price_asc">按价格升序排序</a> |
        <a asp-action="Index" asp-route-sortOrder="price_desc">按价格降序排序</a>
    </p>
</form>

<div>
    @await Html.PartialAsync("_ProductList", Model)
</div>

<div>
    @await Html.PartialAsync("_Pagination", new { TotalCount = ViewBag.TotalCount, CurrentPage = ViewBag.CurrentPage })
</div>